package com.appspot.battlerafts.servlets.game;

import com.appspot.battlerafts.enums.MultiplayerEvents;
import com.appspot.battlerafts.jsons.GameDataJSON;
import com.appspot.battlerafts.utils.Pusher;
import com.google.gson.Gson;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

import static com.appspot.battlerafts.utils.Util.returnSuccess;

/**
 * Created with IntelliJ IDEA.
 * User: Tonis
 * Date: 31.03.12
 * Time: 11:50
 * To change this template use File | Settings | File Templates.
 */
public class RemoveLife extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Gson gson = new Gson();
        String rawInput = request.getParameter("data");
        GameDataJSON data = gson.fromJson(rawInput, GameDataJSON.class);

        Pusher.triggerPush(data.gameID, MultiplayerEvents.REMOVELIFE.toString(), rawInput, data.socketID);
        returnSuccess(response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
